import http from '@/util/http.js';











 //============通道AJAX 方法======================



 //获取场地列表
 export function wayList(pagination, param) {
 	let url = `/passage/way/list/${pagination.pageSize}/${pagination.current}`;
 	return new Promise((resolve, reject) => {
 		http.get(url, param).then(response => {
 			resolve(response)
 		});
 	});
 }

 //新增场地
 export function wayAdd(param) {
 	let url = `/passage/way/add`;
 	return new Promise((resolve, reject) => {
 		http.post(url, param).then(response => {
 			resolve(response)
 		})
 	});
 }


 //根据产地编号ID修改场地
 export function wayUpdate(id,param) {
 	let url = `/passage/way/update/${id}`;
 	return new Promise((resolve, reject) => {
 		http.put(url, param).then(response => {
 			resolve(response)
 		})
 	});
 }


  //根据场地编号删除场地
  export function wayDel(id) {
  	let url = `/passage/way/delete/${id}`;
  	return new Promise((resolve, reject) => {
  		http.delete(url).then(response => {
  			resolve(response)
  		})
  	});
  }






//根据门禁编号设置管理员指纹
export function setWayMaster(dataObj) {
	let url = `/passage/way/setMaster`;
	return new Promise((resolve, reject) => {
		http.post(url,dataObj).then(response => {
			resolve(response)
		})
	});
}



//根据门禁Mac初始化门禁数据
export function wayInit(clientMac) {
	let url = `/passage/way/init/${clientMac}`;
	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response)
		})
	});
}











//获取门禁终端字典列表
export function dictClientMac() {
	let url = `/internal/passage/way/dict`;
	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response.data.result)
		});
	});
}



//======================获取任务列表==============================


//获取场地列表
export function authorizeList(pagination, param) {
	let url = `/passage/authorize/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}


//新增授权计划
export function authorizeAdd(param) {
	let url = `/passage/authorize/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}

//根据计划ID修改授权计划
export function authorizeUpdate(id,param) {
	let url = `/passage/authorize/update/${id}`;
	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}



//根据计划ID删除授权计划
export function authorizeDel(id) {
	let url = `/passage/authorize/delete/${id}`;
	return new Promise((resolve, reject) => {
		http.delete(url).then(response => {
			resolve(response)
		})
	});
}







//根据授权任务Id到授权人员列表
export function authorizestaffList(taskId) {
	let url = `/passage/authorize/staff/list/${taskId}`;
	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response)
		});
	});
}



//根据计划ID 保存授权人员列表
export function saveAuthorizeStaffList(taskId,dataArr) {
	let url = `/passage/authorize/staff/save/${taskId}`;
	return new Promise((resolve, reject) => {
		http.post(url, dataArr).then(response => {
			resolve(response)
		})
	});
}




//根据计划ID立即执行计划任务
export function authorizeRun(id,param) {
	let url = `/passage/authorize/run/${id}`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}






//获取任务场地列表
export function getNoticeList(pagination, param) {
	let url = `/passage/authorize/notice/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}






//通行记录查询
export function recordList(pagination, param) {
	let url = `/passage/record/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}




//通行记录查询
export function wayStaffList(pagination, param) {
	let url = `/passage/way/staff/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}

